<?php
    header('Content-Type:text/html;charset=utf-8');
    $username=$_POST['username'];
    $password=$_POST['password'];
    require_once 'class.php';
    PDOc::_connect();
    PDOc::register($username,$password);
    /*
    $pdo=new PDO('mysql:host=localhost;dbname=dtb','root','');
    if (($username<>'') AND ($password<>'')) {
    	$pdo=new PDO('mysql:host=localhost;dbname=dtb','root','');
    	$sql="SELECT * FROM user WHERE username = '{$username}'";
    	$stmt=$pdo->query($sql);
    	//echo !$stmt->rowCount()==0?'exists.':'not exists.';
    	if ($stmt->rowCount()==0) {
    		$sql="INSERT INTO user(username,password,email,headPic,ifAdmin) VALUES('{$username}','{$password}','','',0)";
    		$res=$pdo->exec($sql);
    		if ($res<>0) echo "创建账户成功。".'<br/>';
    		unset($username); unset($password);
    		echo '<a href="login.php"><input value="登录" type="button"></a>';
    	} else {
    		echo "这个账户已经存在。".'<br/>';
    		unset($username); unset($password);
    		echo '<a href="register.php"><input value="返回注册" type="button"></a>';
    	}
    } else {
        echo '文本框请勿留空！'.'<br/>';
        unset($username); unset($password);
        echo '<a href="register.php"><input value="返回注册" type="button"></a>';
    }
    */
?>